r"""
Simple ORM testing.

>>> from testproj.news.models import *
>>> a1 = Article.objects.create(title='Extra extra', body='Read all about it')
>>> c1 = Comment.objects.create(article=a1, body='A++++ would read again')

>>> # Now to cache a QuerySet...
>>> latest_articles = Article.objects.cache_set('latest_articles')[:10]
>>> latest_articles.is_cached
False

>>> # Okay, now cache the set.
>>> latest_articles[0].title
'Extra extra'
>>> len(latest_articles), latest_articles.is_cached
(1, True)

>>> # What happens when we delete an item that's a part of that set?
>>> a1.delete()
>>> # XXX: TEMP: Force it to re-retrieve the QuerySet data
>>> latest_articles._result_cache = None
>>> len(latest_articles), latest_articles.is_cached
(0, True)

TODO: Need some way of determining if the cache was refreshed or not
"""

if __name__ == '__main__':
    import doctest
    doctest.testmod()
